<script setup>
import {onMounted, ref} from "vue";
import SingleLineInput from "../../components/preview/SingleLineInput.vue";
import {useRoute, useRouter} from "vue-router";
import RadioInput from "../../components/preview/RadioInput.vue";
import CheckboxInput from "../../components/preview/CheckboxInput.vue";
import {getSurveysApi} from "../../apis/SurveysApi.js";
import {Message,Notification} from "@arco-design/web-vue";
import SingleTextarea from "../../components/preview/SingleTextarea.vue";
import useStore, {localGetUserLogin} from "../../store/index.js";
import SingleRate from "../../components/preview/SingleRate.vue";
import AllPreview from "../../components/preview/AllPreview.vue";

/**
 * 查看单张答卷
 */
const defaultBg = new URL('../../assets/default-bg.png', import.meta.url).href;
const router = useRouter()

const props = defineProps({
    surveys: {
        type: Object,
        required:true
    }
})

const surveysStyle = ref({
    backgroundRepeat: 'no-repeat',
    backgroundSize: 'cover',
    backgroundImage: props.surveys.bgimg ? "url(" + props.surveys.bgimg + ")": `url(${defaultBg})`,
})

</script>

<template>
<div class="maxDiv w-full px-4 py-24 min-h-full" :style="surveysStyle">
<!--    问卷设计界面-->
    <div class="max-w-5xl mx-auto rounded border-2 bg-white shadow-lg px-7 pb-10">
        <h1 class="text-2xl text-center font-bold mt-4">{{surveys.title}}</h1>
        <p class="text-lg text-center my-3">{{surveys.description}}</p>

<!--        每题问题-->
        <div v-for="question in surveys.questions" class="mt-5">
            <AllPreview :question="question"/>
        </div>

        <div v-if="!surveys.questions || surveys.questions.length === 0">
            <a-result status="404" subtitle="暂无回答">
            </a-result>
        </div>

        <div class="w-full flex justify-center mt-6">

        </div>
    </div>
</div>
</template>

<style scoped>

</style>
